'use strict';
// Copyright 2014 Blueant Inc. All Rights Reserved.

/**
 * @fileoverview 受到其他玩家攻击时胜利N次
 * @author sundbcn@gmail.com (sun debing)
 */

var _ = require('lodash');

var CopyCondition = function () {

};

/**
 * 验证
 */
CopyCondition.prototype.getProgress = function (condition, record, damage_build_list, data) {
    var lost_soldier_list = data.lost_soldier_list || [];
    var lost_soldier_num = 0;
    _.each(lost_soldier_list, function (lost_soldier) {
        lost_soldier_num += lost_soldier.num;
    });

    return {
        progress: lost_soldier_num,
        total_progress: condition.param1,
        is_pass: Number(lost_soldier_num < condition.param1)
    };
};

module.exports = new CopyCondition();
